package com.ctsi.security.event;


import com.ctsi.commons.event.AbstractObserver;
import com.ctsi.commons.event.BaseEvent;
import com.ctsi.framework.common.startrun.ComponentFactory;
import com.ctsi.organise.common.model.UserLogin;
import com.ctsi.security.service.UserDataObjectService;

public class RemoveUserResWhenDelUser extends AbstractObserver {
    
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 2960922059494919619L;

	private UserDataObjectService getUserDataObjectService(){
		return (UserDataObjectService) ComponentFactory.getBean("userDataObjectService");
	}

	@Override
	public void onEvent(Object[] args) {
	  BaseEvent event=(BaseEvent) args[0];
	  UserLogin userLogin=(UserLogin) event.getSource();
	  String userId=userLogin.getId();
	  getUserDataObjectService().removeAllResByUserId(userId);		
	}
}
